//--------------------------------------------------------------
//
// Qizhi Zhang 
// ezhung@gmail.com
// http://www.moorwind.com
//
//--------------------------------------------------------------
package style.default.skins
{
	import mx.skins.Border;
	import flash.display.Graphics;
	import reader.utils.DrawUtil;

	public class PopUpButtonSkin extends Border
	{
		public function PopUpButtonSkin()
		{
			super();
		}
		
		
		/**
	     *  @private
	     */    
	    override public function get measuredWidth():Number
	    {
	        return 22;
	    }
	    
	    
	    /**
	     *  @private
	     */        
	    override public function get measuredHeight():Number
	    {
	        return 22;
	    }
		
		
		/**
		 * 
		 * @param w
		 * @param h
		 * 
		 */		
		override protected function updateDisplayList(w:Number, h:Number):void
		{
			var g:Graphics = graphics;
            g.clear();
            
            var rectW:Number = w;
			var rectH:Number = h;
			var hightlightAlphas:Array = [0.1, 0.1];
			var innerRectColors:Array = [0xFFFFFF, 0xFFFFFF];
			var innerRectAlphas:Array = [0.08, 0.03];
			var arrowColors:Array = [0x808080, 0x808080];
			
			switch(name)
			{
				case "upSkin":
				{
					break;
				}
				case "popUpOverSkin":
				case "overSkin":
				{
					hightlightAlphas = [0.15, 0.15];
					innerRectAlphas = [0.05, 0.0];
					arrowColors = [0x9900cc, 0x9900cc];
					break;
				}
				case "popUpDownSkin":
				case "downSkin":
				{
					hightlightAlphas = [0.15, 0.15];
					innerRectAlphas = [0.05, 0.0];
					arrowColors = [0x9900ff, 0x9900ff];
					break;
				}
				case "disabledSkin":
				{
					hightlightAlphas = [0.05, 0.05];
					innerRectColors = [0x000000, 0x000000];
					innerRectAlphas = [0.3, 0.3];
					arrowColors = [0xcccccc, 0xcccccc];
					break;
				}
			}
			DrawUtil.drawArrow(g, 5, arrowColors, [1, 1], rectW - 13, Math.floor(rectH/2) - Math.floor(5/2));
		} 
		
	}
}